package com.example.demo.service;

import com.example.demo.dao.UserMapper;
import com.example.demo.model.user.UserVO;
import com.example.demo.model.user.UserCreateModel;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@RequiredArgsConstructor

public class UserService {

    @Autowired
    UserMapper userMapper;

    public int create(UserCreateModel model) {
        System.out.println("进入service");
        int i = userMapper.create(model);
        return i;
    }

    public List<UserVO> getAllUser() {
        System.out.println("进入service");
        List<UserVO> all = userMapper.getAll();
        return all;
    }

    public UserVO getUserById(Integer id) {
        System.out.println("进入service");
        UserVO userVO = userMapper.getById(id);
        return userVO;
    }
}
